From 646568b23c3550f5019ac069adf596dc305ee247 Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Thu, 9 Feb 2006 14:52:40 +0100 Subject: [PATCH] Fix CPU hotplug. Signed-off-by: Keir Fraser --- linux-2.6-xen-sparse/arch/i386/kernel/process-xen.c | 8 ++++++++ linux-2.6-xen-sparse/arch/x86_64/kernel/process-xen.c | 11 +++++++---- linux-2.6-xen-sparse/drivers/xen/core/smpboot.c | 9 +++------ 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/linux-2.6-xen-sparse/arch/i386/kernel/process-xen.c b/linux-2.6-xen-sparse/arch/i386/kernel/process-xen.c index a6f5ac0bd2..e565ad83c7 100644 --- a/linux-2.6-xen-sparse/arch/i386/kernel/process-xen.c +++ b/linux-2.6-xen-sparse/arch/i386/kernel/process-xen.c @@ -124,10 +124,18 @@ EXPORT_SYMBOL(default_idle); #endif #ifdef CONFIG_HOTPLUG_CPU +extern cpumask_t cpu_initialized; static inline void play_dead(void) { idle_task_exit(); + local_irq_disable(); + cpu_clear(smp_processor_id(), cpu_initialized); + preempt_enable_no_resched(); HYPERVISOR_vcpu_op(VCPUOP_down, smp_processor_id(), NULL); + /* Same as drivers/xen/core/smpboot.c:cpu_bringup(). */ + cpu_init(); + touch_softlockup_watchdog(); + preempt_disable(); local_irq_enable(); } #else diff --git a/linux-2.6-xen-sparse/arch/x86_64/kernel/process-xen.c b/linux-2.6-xen-sparse/arch/x86_64/kernel/process-xen.c index 096aab6eef..55a3b5dfdc 100644 --- a/linux-2.6-xen-sparse/arch/x86_64/kernel/process-xen.c +++ b/linux-2.6-xen-sparse/arch/x86_64/kernel/process-xen.c @@ -138,14 +138,17 @@ void xen_idle(void) } #ifdef CONFIG_HOTPLUG_CPU -DECLARE_PER_CPU(int, cpu_state); - -#include -/* We halt the CPU with physical CPU hotplug */ static inline void play_dead(void) { idle_task_exit(); + local_irq_disable(); + cpu_clear(smp_processor_id(), cpu_initialized); + preempt_enable_no_resched(); HYPERVISOR_vcpu_op(VCPUOP_down, smp_processor_id(), NULL); + /* Same as drivers/xen/core/smpboot.c:cpu_bringup(). */ + cpu_init(); + touch_softlockup_watchdog(); + preempt_disable(); local_irq_enable(); } #else diff --git a/linux-2.6-xen-sparse/drivers/xen/core/smpboot.c b/linux-2.6-xen-sparse/drivers/xen/core/smpboot.c index 198cd836b5..d231f85029 100644 --- a/linux-2.6-xen-sparse/drivers/xen/core/smpboot.c +++ b/linux-2.6-xen-sparse/drivers/xen/core/smpboot.c @@ -40,8 +40,6 @@ extern void failsafe_callback(void); extern void system_call(void); extern void smp_trap_init(trap_info_t *); -extern cpumask_t cpu_initialized; - /* Number of siblings per CPU package */ int smp_num_siblings = 1; int phys_proc_id[NR_CPUS]; /* Package ID of each logical CPU */ @@ -141,10 +139,9 @@ static void xen_smp_intr_exit(unsigned int cpu) static void cpu_bringup(void) { - if (!cpu_isset(smp_processor_id(), cpu_initialized)) { - cpu_init(); - preempt_disable(); - } + cpu_init(); + touch_softlockup_watchdog(); + preempt_disable(); local_irq_enable(); cpu_idle(); } -- 2.30.2